import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

export default new Vuex.Store({
	state: {
		type:1,
		devices: [],
		macList:[],
		password:'',
		macsList:[],
		deviceId:'',
		serviceId:'',
		characteristicId:'',
		characteristicIds:'',
		sKey:'1d6012cb038f1cc61abe3006766d6ee4',
		sKeys:'3A60432A5C01211F291E0F4E0C132825',
		order:'',
		newList:'',
		mode:['YIJIAPH5','XY_T129','YIJIATF','PH50']
	},
	mutations: {
		setMode(state,data){
			state.mode=data;
		},
		setSkey(state,data){
			state.sKey=data;
		},
		setPassword(state,data){
		   state.password=data;	
		},
		setList(state,data){
			state.newList=data;
		},
		setOrder(state,data){
			state.order=data;
		},
		setMac(state,data){
		   	state.macList[data.mac]=data.deviceId;
			state.macsList[data.deviceId]=data.mac;
		},
		setType(state,type){
		   state.type=type;	
		},
		setAevices(state, data) {
			state.devices.push(data);
		},
		setDid(state,data){
		  state.deviceId=data;	
		},
		setSid(state,data){
			state.serviceId=data;
		},
		setCharId(state,data){
			state.characteristicId=data;
		},
		setCharIds(state,data){
			state.characteristicIds=data;
		}
	}
});